package cn.chengpengper.rpc.protocol.header;

import cn.chengpengper.rpc.common.id.IdFactory;
import cn.chengpengper.rpc.constants.RpcConstants;
import cn.chengpengper.rpc.protocol.enums.RpcType;

/**
 * @author chengpeng.hu
 */
public class RpcHeaderFactory {

    public static RpcHeader getRequestHeader(String serializationType,RpcType type) {
        RpcHeader header = new RpcHeader();
        header.setMagic(RpcConstants.MAGIC);
        header.setRequestId(IdFactory.getId());
        header.setMsgType(type.getType().byteValue());
        header.setStatus(((byte) 0x1));
        header.setSerializationType(serializationType);
        return header;
    }
}
